package demo.controller;


import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import demo.dao.IUsersDao;
import demo.model.Users;
import demo.service.IUsersService;
import demo.util.JWTUtil;
import demo.util.ResponseData;

@RestController 
@RequestMapping("users")
public class UsersController {

	@Resource
	private IUsersDao usersDao;
	
	@Resource
	private IUsersService service;

	@RequestMapping("login.do")
	public ResponseData login(Users u) {
		
		return new ResponseData("","", "", service.login(u)) ;
	}
	
	@ResponseBody
	@RequestMapping("findAll.do")
	public Map findAll(){
		Map map = new HashMap();
		map.put("code", "0");
		map.put("msg", "");
		map.put("count", 100);
		map.put("data", usersDao.findAll());
		return map;
	}
	
	
}
